﻿using System;
using System.Collections.Generic;
using System.Text;
using LibNoise;

namespace SampleImageGenerator.Modules.Primitives
{
	internal class Sinewave : IModule
	{
		public double Frequency { get; set; }
		public double Scale { get; set; }
		public double X { get; set; }
		public double Y { get; set; }
		public double Z { get; set; }

		public Sinewave()
		{
			Frequency = 1;
			Scale = 1; 
			X = 0;
			Y = 0;
			Z = 0;
		}

		public double GetValue(double x, double y, double z)
		{
			double fx = (x - X) * Frequency;
			double fy = (y - Y) * Frequency;
			double fz = (z - Z) * Frequency;

			double root = System.Math.Sqrt(fx * fx + fy * fy + fz * fz);
			double result = Scale * System.Math.Sin(root);
			return result;
		}
	}
}
